;(() => {
  const arr = [1, [2, [3, 4], 5], 6]
  const flatArr = arr.flat(Infinity) // 输出 [1, 2, 3, 4, 5, 6]
  console.log(flatArr)
  const arr2 = [1, 2, 3, 4]
  const result = arr2.map(v => [v, v * 2]).flat()
  console.log(result); // 输出 [1, 2, 2, 4, 3, 6, 4, 8]
  const result2 = arr2.flatMap(v => [v, v * 2])
  console.log(result2);// 输出 [1, 2, 2, 4, 3, 6, 4, 8]
})()
